minios: fix port selection shifts
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 8 May 2008 10:27:22 +0000 (11:27 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 8 May 2008 10:27:22 +0000 (11:27 +0100)
Event selectors span unsigned longs, whose size is not always 32 bits.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
extras/mini-os/hypervisor.c

index 2840d789ef87aad4fb1c9838ba5921a76bda1b27..3bb47a424d4952e118808ff170e028483d17ffe9 100644 (file)
@@ -58,7 +58,7 @@ void do_hypervisor_callback(struct pt_regs *regs)
             l2i = __ffs(l2);
             l2 &= ~(1 << l2i);
 
-            port = (l1i << 5) + l2i;
+            port = (l1i * (sizeof(unsigned long) * 8)) + l2i;
                        do_event(port, regs);
         }
     }
@@ -100,7 +100,8 @@ inline void unmask_evtchn(u32 port)
      * a real IO-APIC we 'lose the interrupt edge' if the channel is masked.
      */
     if (  synch_test_bit        (port,    &s->evtchn_pending[0]) && 
-         !synch_test_and_set_bit(port>>5, &vcpu_info->evtchn_pending_sel) )
+         !synch_test_and_set_bit(port / (sizeof(unsigned long) * 8),
+              &vcpu_info->evtchn_pending_sel) )
     {
         vcpu_info->evtchn_upcall_pending = 1;
         if ( !vcpu_info->evtchn_upcall_mask )